import {configureStore,combineReducers } from "@reduxjs/toolkit"

import app from "./modules/app";
import user from "./modules/user";


const reducer = combineReducers({
    app,
    user,
})

const store = configureStore({
    reducer,
})

//从store本身推断出 'RootState' 和 'AppDispatch' 类型
export type RootState = ReturnType<typeof store.getState>;
//从而推断出类型： {posts: postsState, comments: CommentsState,users:UserState}
export type AppDispatch = typeof store.dispatch

export default store